import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    //重定向功能：用于默认显示关于我们
    redirect: '/about/us',
    component: () => import('../views/AboutView.vue'),
    children:[
      {
        //二级路由不要加"/"
        path:'us',
        component: () => import('../views/AboutSub/AboutUs.vue')
      },
      {
        path:'info',
        component: () => import('../views/AboutSub/Aboutinfo.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
